package com.zkthink.ceres.app.authority.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zkthink.base.R;
import com.zkthink.ceres.app.authority.dto.*;
import com.zkthink.ceres.member.dto.RelationAccountSearchDTO;
import com.zkthink.ceres.member.vo.JumpWxaVo;
import com.zkthink.jwt.model.AuthInfo;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * Created by kellen on 2020/5/3.
 */
public interface AuthService {

    /**
     * 微信小程序登录
     */
    R loginByWxMa(HttpServletRequest request,MiniAppLoginDTO miniAppLoginDTO);

    R generateScheme(JumpWxaVo jumpWxaVo);

    R loginByWx(MiniAppLoginDTO miniAppLoginDTO);

    R loginTest(String openid);

    R bindPhone(Long mid, MiniAppAuthDTO miniAppAuthDTO);


    R bindWxUserInfo(MiniAppAuthDTO miniAppAuthDTO);

    R<AuthInfo> login(HttpServletRequest request,CommonAppLoginDTO appLoginDTO);

    R register(RegDTO regDTO) throws Exception;


    R updateByAccount(UpdateAppDTO updateAppDTO);

    R update(CommonAppLoginDTO commonAppLoginDTO);

    R<AuthInfo> loginAppByWxMa(MiniAppLoginDTO miniAppLoginDTO) throws Exception;


    R<AuthInfo> bindPhoneByCode(MiniAppPhoneDTO regDTO);

    R logOffAccount(Long mid);

    R logOutAccount(Long mid);

    /**
     * 实体店登录
     *
     * @param appLoginDTO
     * @return
     */
    R<AuthInfo> shopLogin(CommonAppLoginDTO appLoginDTO);

    R<AuthInfo> loginByAdmin(CommonAppLoginDTO appLoginDTO);

    R<AuthInfo> appBindPhoneByCode(MiniAppPhoneDTO regDTO);


    R<String> getOpenidByCode(MiniAppLoginDTO regDTO) throws IOException;

    R<AuthInfo> addRelationAccount(HttpServletRequest request,CommonAppLoginDTO appLoginDTO);


    R deleteRelationAccount(Long id);


    R<IPage<RelationAccountSearchDTO>> searchRelationAccount(IPage page, Long mid);

    R<AuthInfo> loginRelationAccount(Long id);

    R setRoleType(SetRoleTypeDTO setRoleTypeDTO);

    R appOneLoginSetRoleType(Integer roleType);
}
